//2009/08/13 19:48:55
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>

using namespace std;

class MovingAverages
{
public:
    vector <int> calculate(vector <string> times, int n)
    {
		vector<int> ret;
		for(int i=0; i + n -1 < times.size(); i++)
		{
			int total = 0;
			int h,m,s;
			for(int j=i; j<n+i; j++)
			{
				sscanf(times[j].c_str(), "%d:%d:%d", &h, &m ,&s);
				total += h * 3600 + m * 60 + s;
			}
			ret.push_back(total/n);
		}
		return ret;
    }
};
